import pymysql

def executesql(sql):
    con = pymysql.connect(user='root', password='123456', database='ai2110a')
    cursor = con.cursor()
    cursor.execute(sql)
    cursor.close()
    con.commit()
    con.close()



if __name__ == '__main__':
    # sql='create table user (id int primary key auto_increment,uname varchar(20) not null,upwd varchar(20) not null ,role int(1) not null )'
    # sql='create table leave_type(id int primary key auto_increment,tname varchar(20) not null )'
    # sql='insert into user(uname,upwd,role) values (1,"zhangsan","123",1)'
    # sql='insert into user values ("zhangsan","123",1)'
    sql="""create table leaver (id int primary key auto_increment,
        stu_name varchar(20) not null,
         status int not null default 0,
         createTime date not null,
         context varchar(200) not null,
         tid int not null,
         foreign key (tid) references leave_type(id))
         """

    executesql(sql)

